<template>
  <div class="page-department">
    <div class="component-mainHeader">
      <div class="top">
        <div class="topleft">
          <p>
            <span class="iconfont" style="color:#1abc9a;margin-right:3px;">&#xe607;</span>待建项项目
          </p>
        </div>
        <div class="topright">
          <!--<el-button type="info" @click="$router.go(-1)">
            <span style="font-weight:700;margin-right:5px;" class="iconfont">&#xe606;</span>返回
          </el-button>-->
          <el-button type="info" @click="$router.go(0)">
            <span style="font-weight:700;margin-right:5px;" class="iconfont">&#xe662;</span>刷新
          </el-button>
        </div>
      </div>
    </div>
    <div class="component-listHeader">
      <div class="search-header">
        <div class="left-title">
          <p class="left-text">
            <span class="iconfont">&#xe61e;</span>
            {{title}}
          </p>
        </div>
      </div>
    </div>
    <!-- 表格 -->
    <div class="table">
      <el-table ref="multipleTable" :data="info" tooltip-effect="dark" style border>
        <el-table-column label="时间" align="center" width="140" prop="createDate">
          <template slot-scope="scope">{{scope.row.createDate | dateFilter}}</template>
        </el-table-column>
        <el-table-column label="项目编号" align="center" width="130" prop="proNo"></el-table-column>
        <el-table-column label="项目名称" align="center" width="130" prop="proName"></el-table-column>
        <el-table-column label="状态" align="center" width="130" prop="flowStep"></el-table-column>
        <el-table-column label="备注" align="center" prop="errorDesc"></el-table-column>
        <el-table-column label="操作" align="center" width="200">
          <template slot-scope="scope">
              <el-button
              type="text"
              size="small"
              class="red"
              style="color:#1abc9a;"
              @click="$router.push({name:'buildPro',params:{proId:scope.row.proId, belongOrg:scope.row.belongOrg}})"
            >编辑</el-button>
              <el-button
              type="text"
              size="small"
              class="red"
              style="color:#1abc9a;"
              @click="commitInfo(scope.row)"
            >提交审核</el-button>
              <el-button
              type="text"
              size="small"
              class="red"
              style="color:#1abc9a;"
              @click="delInfo(scope.row.proId,scope.row.flowStep)"
            >删除</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>

<script>
export default {
  name: "unTakePro",
  data() {
    return {
      title: "建项列表",
      info: [{}]
    };
  },
  mounted() {
    this.dataInit();
  },
  methods: {
    // 表格数据初始化

    dataInit() {
      let that = this,
        suCb = res => {
          console.log(res);
          that.info = that.deepClone(res.data.data);
        },
        erCb = res => {
          
        },
        req = {
          url: "/api/web/proProject/FlowStepAndbohui",
          methods: "post",
          data:'',
          success: suCb,
          error: erCb
        };
      console.log(req);
      that.$https(req);
    },
    // 删除按钮
    delInfo(id,flowStep) {
      this.$confirm("确认删除吗？")
        .then(_ => {
          let that = this,
            suCb = res => {
              that.$msg("删除成功！");
              that.dataInit();
            },
            erCb = res => {
              
            },
            req = {
              url: "/api/web/proProject/deleteByProId",
              methods: "post",
              data: {
                proId: id,
                msg:flowStep
              },
              success: suCb,
              error: erCb
            };
            console.log(req.data)
          that.$https(req);
        })
        .catch(_ => {});
    },
    // 提交审核
    commitInfo(id) {
      console.log(id)
      let that = this,
        suCb = res => {
          console.log("文员提交审核结果：", res);
          if(res.data.flag == 1){
            that.$msg('提交成功！')
            that.dataInit();
          }
        },
        erCb = res => {
          console.log(res);
        },
        req = {
          url: "/api/web/proProject/updateProCheck",
          methods: "post",
          data: {
            proId: id.proId
          },
          success: suCb,
          error: erCb
        };
      that.$https(req);
    }
  }
};
</script>

<style scoped>
.component-searchHeader .search-header {
  width: 1100px;
  box-sizing: border-box;
  border: 1px solid rgba(228, 228, 228, 1);
  background-color: rgba(255, 255, 255, 1);
  margin: 20px auto 0;
}

.component-searchHeader .search-header .left-title {
  display: flex;
  justify-content: space-between;
  width: 100%;
  background-color: rgba(243, 243, 243, 1);
  height: 45px;
  box-sizing: border-box;
}

.component-searchHeader .search-header .left-title .left-text {
  width: 20%;
  color: #666;
  line-height: 45px;
  font-family: "微软雅黑";
  font-weight: 400;
  font-size: 12px;
  text-align: left;
  margin: 0 0 0 30px;
}

.component-searchHeader .right {
  width: 70%;
  display: flex;
  justify-content: flex-end;
  margin-right: 30px;
}

.component-searchHeader .right button {
  padding: 0 15px;
  height: 30px;
  margin: 6px 5px;
  line-height: 30px;
  font-size: 12px;
  color: #666;
  background-color: #fff;
  border: 1px solid #ccc;
}

.component-searchHeader .right button:hover {
  background-color: #f3f3f3;
}

.component-search-box {
  width: 1100px;

  box-sizing: border-box;
  background-color: #fff;
  border: 1px solid #e4e4e4;
  border-top: none;
  margin: 0 auto;
  text-align: left;
  padding-left: 30px;
  line-height: 60px;
}

.component-search-box .el-input__inner {
  height: 35px;
  display: inline-block;
}

.component-listHeader .search-header {
  width: 1100px;
  box-sizing: border-box;
  border: 1px solid rgba(228, 228, 228, 1);
  background-color: rgba(255, 255, 255, 1);
  margin: 20px auto 0;
  border-bottom: 0;
}

.component-listHeader .search-header .left-title {
  display: flex;
  justify-content: space-between;
  width: 100%;
  background-color: rgba(243, 243, 243, 1);
  height: 45px;
  box-sizing: border-box;
}

.component-listHeader .search-header .left-title .left-text {
  width: 20%;
  color: #666;
  line-height: 45px;
  font-family: "微软雅黑";
  font-weight: 400;
  font-size: 12px;
  text-align: left;
  margin: 0 0 0 30px;
}

.component-listHeader .search-header .right {
  width: 70%;
  display: flex;
  justify-content: flex-end;
  margin-right: 10px;
}

.component-listHeader .search-header .right button {
  padding: 0 15px;
  height: 30px;
  width: 80px;
  margin: 6px 5px;
  line-height: 30px;
  font-size: 14px;
  color: #666;
  background-color: #fff;
  border: 1px solid #ccc;
}

.component-listHeader .search-header .right button:hover {
  background-color: #f3f3f3;
}

.right button:hover {
  cursor: pointer;
}
.component-listHeader .search-header .right .right-select-margin {
  margin-top: 6px;
  margin-right: 8px;
}

.component-table-header {
  width: 1100px;
  margin: 0 auto;
  display: flex;
  border: 1px solid #e4e4e4;
  background-color: #f9fafc;
  height: 45px;
  line-height: 45px;
  padding: 0;
  list-style: none;
  justify-content: space-between;
  box-sizing: border-box;
  border-top: none;
}

.component-table-body {
  width: 1100px;
  margin: 0 auto;
  display: flex;
  border: 1px solid #e4e4e4;
  background-color: #fff;
  height: 45px;
  line-height: 45px;
  padding: 0;
  list-style: none;
  justify-content: space-between;
  box-sizing: border-box;
  border-top: none;
}

.table {
  width: 1100px;
  margin: 0 auto;
}

.el-table .cell a {
  color: #1abc9a;
  text-decoration: none;
  cursor: pointer;
}
</style>
